package com.objetdirect.gwt.umldrawer.shared.dto;

import java.io.Serializable;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

@Entity
@Table (name = "DIAGRAM")
public class DiagramDto implements Serializable {

	private static final long serialVersionUID = 1L;

	@Id
	@GeneratedValue
	@Column (name = "diagram_id", nullable = false, unique = false)
	private long diagramId ;
	
	@Column (name = "diagram_name", nullable = false, length = 50)
	private String diagramName ;
	
	@Column (name = "diagram_type", nullable = false, length = 50)
	private String diagramType ;
	
	@Column (name = "diagram_path", nullable = false, length = 150)
	private String diagramPath ;
	
	@ManyToOne (fetch = FetchType.LAZY, cascade = CascadeType.REMOVE, targetEntity = ProjectDto.class)
	@JoinColumn (name = "project_id")
	private ProjectDto projectId ;
	
	public DiagramDto() {
	}
	
	public DiagramDto(long diagramId) {
		this.diagramId = diagramId ;
	}
	
	public DiagramDto(String diagramName, String diagramType,
			String diagramPath, ProjectDto projectId) {
		super();
		this.diagramName = diagramName;
		this.diagramType = diagramType;
		this.diagramPath = diagramPath;
		this.setProjectId(projectId);
	}
	
	public DiagramDto(long diagramId, String diagramName, String diagramType,
			String diagramPath, ProjectDto projectId) {
		super();
		this.diagramId = diagramId;
		this.diagramName = diagramName;
		this.diagramType = diagramType;
		this.diagramPath = diagramPath;
		this.setProjectId(projectId);
	}

	public long getDiagramId() {
		return diagramId;
	}

	public void setDiagramId(long diagramId) {
		this.diagramId = diagramId;
	}

	public String getDiagramName() {
		return diagramName;
	}

	public void setDiagramName(String diagramName) {
		this.diagramName = diagramName;
	}

	public String getDiagramType() {
		return diagramType;
	}

	public void setDiagramType(String diagramType) {
		this.diagramType = diagramType;
	}

	public String getDiagramPath() {
		return diagramPath;
	}

	public void setDiagramPath(String diagramPath) {
		this.diagramPath = diagramPath;
	}

	public void setProjectId(ProjectDto projectId) {
		this.projectId = projectId;
	}

	public ProjectDto getProjectId() {
		return projectId;
	}
}
